//
//  MKAPITestDownloadImage.m
//  MKAPITests
//
//  Created by 苏尚进 on 2022/9/12.
//  Copyright © 2022 moon. All rights reserved.
//

#import "MKAPITestDownloadImage.h"

@interface MKAPITestDownloadImage()
@property(nonatomic,strong) UIImage *image;
@end

@implementation MKAPITestDownloadImage
- (MKAPIHttpRequestType)requestType{
    return MKAPIHttpRequestTypeDownload;
}
- (void)doRunTask{
    [super doRunTask];
    MKAPIRequestParamJSON *requestParam = [[MKAPIRequestParamJSON alloc] init];
    [self configCommonRequest:requestParam path:@"/image/jpeg"];
    requestParam.jsonParam.P(@"filesize", @"small");
    requestParam.httpMethod = MKAPIHttpRequestMethodGET;
    
    [self sendRequestWithParam:requestParam withCompletion:^(__kindof MKAPIHttpRequestBase * _Nullable requestTask, BOOL success, NSError * _Nullable error) {
        if(!error){
            self.image = requestTask.responseImage;
        }
        [self completeWithError:error];
    }];
}
@end
